export type TURNOUT_TYPES = 'left_hand_turnout' | "right_hand_turnout" | 'bilateral_turnout' | 'three_row_turnout'
export type LEFT_HAND_TURNOUT_STATES = 'normal' | 'left'
export type RIGHT_HAND_TURNOUT_STATES = 'normal' | 'right'
export type BILATERAL_HAND_TURNOUT_STATES = 'left' | 'right'
export type THREE_ROW_TURNOUT_STATES = 'normal' | 'left' | 'right'
export type TURNOUT_STATES = LEFT_HAND_TURNOUT_STATES | RIGHT_HAND_TURNOUT_STATES | BILATERAL_HAND_TURNOUT_STATES | THREE_ROW_TURNOUT_STATES
export interface WifiDevice {
    name: string
    role: 'ground-control' | 'locomotive-control'
    ip: string
}

export interface MagnetConfig {
    ground_controller_name: string; // 地面控制器的名称
    index: number; // 位于第多少个电磁铁槽位，从0开始
    reversed: boolean;
}

export interface Turnout {
    name: string;
    type: TURNOUT_TYPES; // 道岔的类型
    // state: LEFT_HAND_TURNOUT_STATES | RIGHT_HAND_TURNOUT_STATES | BILATERAL_HAND_TURNOUT_STATES | THREE_ROW_TURNOUT_STATES;
    magnets: MagnetConfig[]; // 绑定到该道岔的电磁铁
}

export interface DeviceConfig {
    name: string; // 与 wifi_device 的名称一致。
    wifi_device?: WifiDevice; // 可选的 WifiDevice 对象
    switches: Turnout[]; // 注册的道岔列表
}

export interface DeviceFunctionalConfig{
    uuid: string;
    device_name: string;
    motor_reversed: boolean;
    drive_curve: number[];
    electromagnet_595_chips: number;
    led_595_chips: number;
}